import type { ErrorMessageMode } from '/#/axios'
import { httpToEdcomAPI } from '@/utils/http/axios'

enum API {
  GetMenuList = '/getMenuNodes',
}

export interface ListPageResultModel {
  current: number;
  hitCount: boolean;
  pages: number;
  records: [];
  searchCount: boolean;
  size: number;
  total: number;
}

// 模板对象
export interface IplatMenuModel {
  text: string;
  label: string;
  leaf: number;
  childNodes: IplatMenuModel[];
}

/**
 * @description: 根据用户ID获取对应菜单项
 */
export function getMenuNodes(username: string) {
  const params = { userId: username }
  return httpToEdcomAPI.post<IplatMenuModel[]>({ url: API.GetMenuList, params })
}
